ALMaSS  1.0
The Animal, Landscape and Man Simulation System
Bembidion_Population_Manager Class Reference

The population manager class for beetles. More...

#include <bembidion_all.h>

Inheritance diagram for Bembidion_Population_Manager:
Population_Manager

Public Member Functions

void CreateObjects (int ob_type, TAnimal *pvo, void *null, struct_Bembidion *data, int number)
 Method to add beetles to the population. More...
 
virtual void Init (void)
 Intialises the population manager. More...
 
virtual void DoFirst (void)
 Does day degree development calculations here. More...
 
virtual void DoBefore (void)
 Replaces the Step function for the Egg_List. More...
 
virtual void DoAlmostLast (void)
 Removes dead or pupated larvae from the simulation. More...
 
virtual void DoLast (void)
 Adds output adult locations to DoLast. More...
 
virtual float Probe (int ListIndex, probe_data *p_TheProbe)
 Overides the Population_Manager::Probe method. More...
 
 Bembidion_Population_Manager (Landscape *p_L)
 Constructor. More...
 
virtual ~Bembidion_Population_Manager ()
 Destructor. More...
 
int SupplyAdPopSize ()
 Get adult population size. More...
 
int SupplyEggPopSize ()
 Get egg population size. More...
 
int SupplyLarvaePopSize ()
 Get larval population size. More...
 
int SupplyPupaePopSize ()
 Get pupal population size. More...
 
double SupplyEDayDeg (int day)
 Get egg day degress for a specific day. More...
 
double SupplyLDayDeg (int L, int day)
 Get larval day degress for a specific dayand instar. More...
 
double SupplyPDayDeg (int day)
 Get pupal day degress for a specific day. More...
 
- Public Member Functions inherited from Population_Manager
 Population_Manager (Landscape *L)
 
virtual ~Population_Manager (void)
 
void SetNoProbes (int a_pn)
 
unsigned GetLiveArraySize (int a_listindex)
 Gets the number of 'live' objects for a list index in the TheArray. More...
 
void IncLiveArraySize (int a_listindex)
 Increments the number of 'live' objects for a list index in the TheArray. More...
 
virtual void Catastrophe (int)
 
unsigned int FarmAnimalCensus (unsigned int a_farm, unsigned int a_typeofanimal)
 
char * SpeciesSpecificReporting (int a_species, int a_time)
 
char * ProbeReport (int a_time)
 
char * ProbeReportTimed (int a_time)
 
void ImpactProbeReport (int a_Time)
 
bool BeginningOfMonth ()
 
void LOG (const char *fname)
 
int SupplyStepSize ()
 
int SupplySimW ()
 
int SupplySimH ()
 
virtual void Run (int NoTSteps)
 
virtual void ImpactedProbe ()
 
int SupplyListNameLength ()
 
TAnimalSupplyAnimalPtr (int a_index, int a_animal)
 Returns the pointer indexed by a_index and a_animal. Note NO RANGE CHECK. More...
 
unsigned SupplyListIndexSize ()
 
unsigned SupplyListSize (unsigned listindex)
 
bool CheckXY (int l, int i)
 Debug method to test for out of bounds coordinates. More...
 
const char * SupplyListName (int i)
 
bool IsLast (unsigned listindex)
 
int SupplyState (unsigned listindex, unsigned j)
 
virtual void SupplyLocXY (unsigned listindex, unsigned j, int &x, int &y)
 
const char * SupplyStateNames (int i)
 
unsigned SupplyStateNamesLength ()
 
virtual void DisplayLocations ()
 
int ProbeFileInput (char *p_Filename, int p_ProbeNo)
 
TAnimalFindClosest (int x, int y, unsigned Type)
 
bool OpenTheRipleysOutputProbe (string a_NWordFilename)
 
void OpenTheAOROutputProbe (string a_AORFilename)
 
bool OpenTheMonthlyRipleysOutputProbe ()
 
bool OpenTheReallyBigProbe ()
 
void CloseTheMonthlyRipleysOutputProbe ()
 
virtual void CloseTheRipleysOutputProbe ()
 
virtual void CloseTheReallyBigOutputProbe ()
 
TTypesOfPopulation GetPopulationType ()
 
int GetSeasonNumber ()
 Get the season number. More...
 
void LamdaDeath (int x, int y)
 
void LamdaBirth (int x, int y)
 
void LamdaBirth (int x, int y, int z)
 
void LamdaClear ()
 
void LamdaDumpOutput ()
 
virtual int SupplyPegPosx (int)
 
virtual int SupplyPegPosy (int)
 
virtual int SupplyCovPosx (int)
 
virtual int SupplyCovPosy (int)
 
virtual bool OpenTheFledgelingProbe ()
 
virtual bool OpenTheBreedingPairsProbe ()
 
virtual bool OpenTheBreedingSuccessProbe ()
 
virtual void BreedingPairsOutput (int)
 
virtual int TheBreedingFemalesProbe (int)
 
virtual int TheFledgelingProbe ()
 
virtual void BreedingSuccessProbeOutput (double, int, int, int, int, int, int, int)
 
virtual int TheBreedingSuccessProbe (int &, int &, int &, int &, int &, int &)
 
virtual void FledgelingProbeOutput (int, int)
 
virtual void TheGeneticProbe (unsigned, int, unsigned &)
 
virtual void GeneticsResultsOutput (FILE *, unsigned)
 

Public Attributes

MovementMapm_MoveMap
 Map of suitability for movement. More...
 
SimplePositionMapm_LarvaePosMap
 Optimised map of larval positions. More...
 
SimplePositionMapm_AdultPosMap
 Optimsied map of adult positions. More...
 
int LDDepMort0
 Storage for density-dependent mortality parameter. More...
 
double LDDepMort1
 Storage for density-dependent mortality parameter. More...
 
int ADDepMort0
 Storage for density-dependent mortality parameter. More...
 
double ADDepMort1
 Storage for density-dependent mortality parameter. More...
 
int TodaysEggProduction
 Daily temperature determined egg production. More...
 
Bembidion_Egg_Listm_EList [365]
 Replacement for TheArray[0]. More...
 
- Public Attributes inherited from Population_Manager
int IndexArrayX [5][10000]
 
probe_dataTheProbe [100]
 
int SimH
 
int SimW
 
unsigned SimHH
 
unsigned SimWH
 
char m_SimulationName [255]
 
bool ProbesSet
 
Landscapem_TheLandscape
 

Protected Member Functions

virtual void Catastrophe ()
 Method to arbitrarily alter populations size. More...
 
virtual void TheRipleysOutputProbe (FILE *a_prb)
 Special output functionality. More...
 
virtual void TheReallyBigOutputProbe ()
 Special output functionality. More...
 
virtual void TheAOROutputProbe ()
 Special output functionality. More...
 
bool IsStartHabitat (int a_x, int a_y)
 Used to specify legal starting habitats for simulation start-up. More...
 
- Protected Member Functions inherited from Population_Manager
virtual bool StepFinished ()
 Overrides the population manager StepFinished - there is no chance that hunters do not finish a step behaviour. More...
 
virtual void DoAfter ()
 
void EmptyTheArray ()
 Removes all objects from the TheArray by deleting them and clearing TheArray. More...
 
void SortX (unsigned Type)
 
void SortXIndex (unsigned Type)
 
void SortY (unsigned Type)
 
void SortState (unsigned Type)
 
void SortStateR (unsigned Type)
 
unsigned PartitionLiveDead (unsigned Type)
 
void Shuffle_or_Sort (unsigned Type)
 
void Shuffle (unsigned Type)
 

Protected Attributes

LandscapeThe_Landscape
 Pointer to the landscape. More...
 
int m_AdPopSize
 To store the current population size. More...
 
int m_EPopSize
 To store the current population size. More...
 
int m_LPopSize
 To store the current population size. More...
 
int m_PPopSize
 To store the current population size. More...
 
double m_EDayDeg [365]
 Storage for daily day degrees for eggs. More...
 
double m_LDayDeg [365][3]
 Storage for daily day degrees for larve. More...
 
double m_PDayDeg [365]
 Storage for daily day degrees for pupae. More...
 
- Protected Attributes inherited from Population_Manager
vector< unsigned > m_LiveArraySize
 
int m_NoProbes
 
AOR_Probem_AOR_Probe
 
FILE * m_GeneticsFile
 
FILE * m_AlleleFreqsFile
 
FILE * m_EasyPopRes
 
const char * StateNames [100]
 
int m_catastrophestartyear
 
int m_StepSize
 
vector< TListOfAnimalsTheArray
 
unsigned StateNamesLength
 
const char * m_ListNames [32]
 
unsigned m_ListNameLength
 
FILE * TestFile
 
FILE * TestFile2
 
unsigned BeforeStepActions [12]
 
int m_SeasonNumber
 Holds the season number. Used when running goose and hunter sims. More...
 
TTypesOfPopulation m_population_type
 
ofstream * AOROutputPrb
 
FILE * RipleysOutputPrb
 
FILE * RipleysOutputPrb1
 
FILE * RipleysOutputPrb2
 
FILE * RipleysOutputPrb3
 
FILE * RipleysOutputPrb4
 
FILE * RipleysOutputPrb5
 
FILE * RipleysOutputPrb6
 
FILE * RipleysOutputPrb7
 
FILE * RipleysOutputPrb8
 
FILE * RipleysOutputPrb9
 
FILE * RipleysOutputPrb10
 
FILE * RipleysOutputPrb11
 
FILE * RipleysOutputPrb12
 
FILE * ReallyBigOutputPrb
 
long int lamdagrid [2][257][257]
 

Detailed Description

The population manager class for beetles.

Constructor & Destructor Documentation

◆ Bembidion_Population_Manager()

Bembidion_Population_Manager::Bembidion_Population_Manager ( Landscape p_L)

Constructor.

2356  : Population_Manager(p_L)
2357 {
2358  // Four lists are needed so need to remove 6 of the ten default arrays
2359  // Eggs, Larvae, Pupae & Adults
2360  for (int i=0; i<4; i++)
2361  {
2362  TheArray.pop_back();
2363  }
2364  m_MoveMap=new MovementMap(p_L, 0); // 0 for beetles
2367 // Create the egg lists
2368  for (int i=0; i<365; i++)
2369  {
2370  m_EList[i]=new Bembidion_Egg_List(i,this,p_L);
2371 
2372  }
2373  // Clear the m_DayDeg array
2374  for (int i=0; i<365; i++)
2375  {
2376  m_EDayDeg[i]=0;
2377  m_LDayDeg[i][0]=0;
2378  m_LDayDeg[i][1]=0;
2379  m_LDayDeg[i][2]=0;
2380  m_PDayDeg[i]=0;
2381  }
2388  Init();
2389 }
static CfgInt cfg_ADDepMort0("BEM_ADDEPMORTZERO", CFG_CUSTOM, 2)
Adult density dependent mortality constant.
static CfgInt cfg_LDDepMort1("BEM_LDDEPMORTONE", CFG_CUSTOM, 0)
Larval density dependent mortality.
int MaxDailyMovement
Definition: Bembidion_all.cpp:145
static CfgInt cfg_LDDepMort0("BEM_LDDEPMORTZERO", CFG_CUSTOM, 3)
Larval density dependent mortality.
static CfgInt cfg_MaxDailyMovement("BEM_MAXDAILYMOVEMENT", CFG_CUSTOM, 14)
Max daily movement in m.
static CfgInt cfg_ADDepMort1("BEM_ADDEPMORTONE", CFG_CUSTOM, 10)
Chance of death if there is another adult within the density-dependent range square this beetle is in...
The class describing the beetle Egg_List objects.
Definition: bembidion_all.h:173
SimplePositionMap * m_LarvaePosMap
Optimised map of larval positions.
Definition: bembidion_all.h:470
int TodaysEggProduction
Daily temperature determined egg production.
Definition: bembidion_all.h:482
virtual void Init(void)
Intialises the population manager.
Definition: Bembidion_all.cpp:2408
double LDDepMort1
Storage for density-dependent mortality parameter.
Definition: bembidion_all.h:476
Bembidion_Egg_List * m_EList[365]
Replacement for TheArray[0].
Definition: bembidion_all.h:484
SimplePositionMap * m_AdultPosMap
Optimsied map of adult positions.
Definition: bembidion_all.h:472
double ADDepMort1
Storage for density-dependent mortality parameter.
Definition: bembidion_all.h:480
int ADDepMort0
Storage for density-dependent mortality parameter.
Definition: bembidion_all.h:478
double m_EDayDeg[365]
Storage for daily day degrees for eggs.
Definition: bembidion_all.h:461
int LDDepMort0
Storage for density-dependent mortality parameter.
Definition: bembidion_all.h:474
double m_PDayDeg[365]
Storage for daily day degrees for pupae.
Definition: bembidion_all.h:465
MovementMap * m_MoveMap
Map of suitability for movement.
Definition: bembidion_all.h:468
double m_LDayDeg[365][3]
Storage for daily day degrees for larve.
Definition: bembidion_all.h:463
int value(void)
Definition: configurator.h:98
Movement maps are used for rapid computing of animal movement.
Definition: MovementMap.h:51
Population_Manager(Landscape *L)
Definition: PopulationManager.cpp:221
vector< TListOfAnimals > TheArray
Definition: PopulationManager.h:534
Used to map locations of individuals for density estimates - space inefficient but good for testing.
Definition: positionmap.h:47

References ADDepMort0, ADDepMort1, cfg_ADDepMort0, cfg_ADDepMort1, cfg_LDDepMort0, cfg_LDDepMort1, cfg_MaxDailyMovement, Init(), LDDepMort0, LDDepMort1, m_AdultPosMap, m_EDayDeg, m_EList, m_LarvaePosMap, m_LDayDeg, m_MoveMap, m_PDayDeg, MaxDailyMovement, Population_Manager::TheArray, TodaysEggProduction, and CfgInt::value().

◆ ~Bembidion_Population_Manager()

Bembidion_Population_Manager::~Bembidion_Population_Manager ( )
virtual

Destructor.

2394 {
2395  for (int i=0; i<365; i++) delete m_EList[i];
2396  delete m_MoveMap;
2397  delete m_LarvaePosMap;
2398  delete m_AdultPosMap;
2399 }

References m_AdultPosMap, m_EList, m_LarvaePosMap, and m_MoveMap.

Member Function Documentation

◆ Catastrophe()

void Bembidion_Population_Manager::Catastrophe ( void  )
protectedvirtual

Method to arbitrarily alter populations size.

This method simply alters populations on 1st January - either by increasing or decreasing them. Increases are by 'cloning', decrease by pro-rata mortality. The effect is under the control of configuration variables cfg_pm_eventfrequency and cfg_pm_eventsize.

Reimplemented from Population_Manager.

3060  {
3061 
3062  // First do we have the right day?
3063  int today = m_TheLandscape->SupplyDayInYear();
3064  if (today!=1) return;
3065  // First do we have the right year?
3067  if (year%cfg_pm_eventfrequency.value()!=0) return;
3068 
3069  Bembidion_Adult* BA = NULL;
3070  // Now if the % decrease is higher or lower than 100 we need to do different things
3071  int esize=cfg_pm_eventsize.value();
3072  if (esize<100) {
3073  unsigned size2;
3074  size2 = (unsigned)GetLiveArraySize( bob_Adult );
3075  for ( unsigned j = 0; j < size2; j++ ) {
3076  if (random(100) > esize) {
3077  BA = dynamic_cast < Bembidion_Adult * > ( TheArray[ bob_Adult ] [ j ] );
3078  BA->CurrentBState=tobs_ADying; // Kill it
3079  }
3080  }
3081  }
3082  else if (esize>100) {
3083  // This also requires a copy method in the target animals
3084  // esize also needs translating 120 = 20%, 200 = 100%
3085  if (esize<200) {
3086  esize-=100;
3087  unsigned size2;
3088  size2 = (unsigned)GetLiveArraySize( bob_Adult );
3089  for ( unsigned j = 0; j < size2; j++ ) {
3090  if (random(100) < esize) {
3091  BA = dynamic_cast < Bembidion_Adult * > ( TheArray[ bob_Adult ] [ j ] );
3092  BA->CopyMyself(bob_Adult); // Duplicate it
3093  }
3094  }
3095  } else {
3096  esize-=100;
3097  esize/=100; // this will throw away fractional parts so will get 1, 2, 3 from 200, 350 400
3098  unsigned size2;
3099  size2 = (unsigned)GetLiveArraySize( bob_Adult );
3100  for ( unsigned j = 0; j < size2; j++ ) {
3101  for ( int e=0; e<esize; e++) {
3102  BA = dynamic_cast < Bembidion_Adult * > (TheArray[bob_Adult][j]);
3103  BA->CopyMyself(bob_Adult); // Duplicate it
3104  }
3105  }
3106  }
3107  }
3108  else return; // No change so do nothing
3109 }
int random(int a_range)
Definition: ALMaSS_CmdLine.cpp:142
CfgInt cfg_pm_eventsize
CfgInt cfg_pm_eventfrequency
@ tobs_ADying
Definition: bembidion_all.h:53
@ bob_Adult
Definition: bembidion_all.h:65
The class describing the adult (female) beetle objects.
Definition: bembidion_all.h:292
TTypesOfBeetleState CurrentBState
Current behavioural state.
Definition: bembidion_all.h:159
void CopyMyself(int a_beetle)
For experimental purposes.
Definition: Bembidion_all.cpp:240
int SupplyYearNumber(void)
Definition: landscape.h:1616
int SupplyDayInYear(void)
Definition: landscape.h:1596
int m_catastrophestartyear
Definition: PopulationManager.h:532
unsigned GetLiveArraySize(int a_listindex)
Gets the number of 'live' objects for a list index in the TheArray.
Definition: PopulationManager.h:433
Landscape * m_TheLandscape
Definition: PopulationManager.h:515

References bob_Adult, cfg_pm_eventfrequency, cfg_pm_eventsize, Bembidion_Base::CopyMyself(), Bembidion_Base::CurrentBState, Population_Manager::GetLiveArraySize(), Population_Manager::m_catastrophestartyear, Population_Manager::m_TheLandscape, random(), Landscape::SupplyDayInYear(), Landscape::SupplyYearNumber(), Population_Manager::TheArray, tobs_ADying, and CfgInt::value().

◆ CreateObjects()

void Bembidion_Population_Manager::CreateObjects ( int  ob_type,
TAnimal pvo,
void *  null,
struct_Bembidion data,
int  number 
)

Method to add beetles to the population.

All bembidion objects that are created must be created using this method. Data on the location and other attributes are passed in data, and the number to create in number.

2944 {
2945  Bembidion_Adult* new_Adult;
2946  Bembidion_Pupae* new_Pupa;
2947  Bembidion_Larvae* new_Larva;
2948 
2949  for (int i=0; i<number; i++)
2950  {
2951  if (ob_type == 0)
2952  {
2953  m_EList[data->L->SupplyDayInYear()]->AddEgg(data->x, data->y);
2954  }
2955  if (ob_type == 1) {
2956  // Will not create a new larva in a square already occupied
2957  if (m_LarvaePosMap->GetMapValue( data->x, data->y ) == 0) {
2958  m_LarvaePosMap->SetMapValue( data->x, data->y );
2959  if (unsigned(TheArray[ob_type].size())>GetLiveArraySize(ob_type )) {
2960  // We need to reuse an object
2961  dynamic_cast<Bembidion_Larvae*>(TheArray[ob_type][GetLiveArraySize(ob_type) ])->ReInit(data->x, data->y, data->L, this);
2962  IncLiveArraySize(ob_type);
2963  }
2964  else {
2965  new_Larva = new Bembidion_Larvae( data->x, data->y, data->L, this );
2966  //TheArray[ ob_type ].insert( TheArray[ ob_type ].begin(), new_Larva );
2967  TheArray[ ob_type ].push_back( new_Larva );
2968  IncLiveArraySize(ob_type);
2969  }
2970  }
2971  }
2972  if (ob_type == 2)
2973  {
2974  if (unsigned(TheArray[ob_type].size())>GetLiveArraySize(ob_type)) {
2975  // We need to reuse an object
2976  dynamic_cast<Bembidion_Pupae*>(TheArray[ob_type][GetLiveArraySize(ob_type)])->ReInit(data->x, data->y, data->L, this);
2977  IncLiveArraySize(ob_type);
2978  }
2979  else {
2980  new_Pupa = new Bembidion_Pupae( data->x, data->y, data->L, this );
2981  TheArray[ ob_type ].push_back( new_Pupa );
2982  IncLiveArraySize(ob_type);
2983  }
2984  }
2985  if (ob_type == 3)
2986  {
2987  if (unsigned(TheArray[ob_type].size())>GetLiveArraySize(ob_type)) {
2988  // We need to reuse an object
2989  dynamic_cast<Bembidion_Adult*>(TheArray[ob_type][GetLiveArraySize(ob_type)])->ReInit(data->x, data->y, data->L, this);
2990  IncLiveArraySize(ob_type);
2991  }
2992  else {
2993  new_Adult = new Bembidion_Adult( data->x, data->y, data->L, this );
2994  TheArray[ ob_type ].push_back( new_Adult );
2995  IncLiveArraySize(ob_type);
2996  }
2997  }
2998  }
2999 }
void AddEgg(int x, int y)
Add an egg to the list.
Definition: bembidion_all.h:188
The class describing the beetle larvae objects.
Definition: bembidion_all.h:217
The class describing the beetle pupae objects.
Definition: bembidion_all.h:256
void IncLiveArraySize(int a_listindex)
Increments the number of 'live' objects for a list index in the TheArray.
Definition: PopulationManager.h:437
virtual bool GetMapValue(unsigned a_x, unsigned a_y)
Definition: positionmap.h:51
virtual void SetMapValue(unsigned a_x, unsigned a_y)
Definition: positionmap.h:56
int x
Definition: bembidion_all.h:117
Landscape * L
Definition: bembidion_all.h:119
int y
Definition: bembidion_all.h:118

References Bembidion_Egg_List::AddEgg(), Population_Manager::GetLiveArraySize(), SimplePositionMap::GetMapValue(), Population_Manager::IncLiveArraySize(), struct_Bembidion::L, m_EList, m_LarvaePosMap, SimplePositionMap::SetMapValue(), Landscape::SupplyDayInYear(), Population_Manager::TheArray, struct_Bembidion::x, and struct_Bembidion::y.

Referenced by Bembidion_Base::CopyMyself(), Bembidion_Base::CopyMyselfB(), Init(), Bembidion_Adult::Reproduce(), Bembidion_Pupae::st_Emerge(), Bembidion_Egg_List::st_Hatch(), and Bembidion_Larvae::st_Pupate().

◆ DoAlmostLast()

void Bembidion_Population_Manager::DoAlmostLast ( void  )
virtual

Removes dead or pupated larvae from the simulation.

This sorts the larval list according to state, then removes the dead ones. This is a little faster than leaving the job to the default population manager functionality.

Reimplemented from Population_Manager.

2737 {
2738 }

◆ DoBefore()

void Bembidion_Population_Manager::DoBefore ( void  )
virtual

Replaces the Step function for the Egg_List.

Reimplemented from Population_Manager.

2672 {
2673  // This replaces the step function for the eggs
2674  for (int i=0; i<365; i++) m_EList[i]->SetStepDone(false);
2675  for (int i=0; i<365; i++) m_EList[i]->Step();
2676 
2677 }

References m_EList.

◆ DoFirst()

void Bembidion_Population_Manager::DoFirst ( void  )
virtual

Does day degree development calculations here.

This method removes any young stages that have survived until winter.
It subsequently calculates day degree development for each day for each beetle stage. This is an optimising strategy to prevent each beetle individual calculating these.
Finally it replaces the Egg_List BeginStep functionality. This is also an optimisation since it only requires 365 Egg_lists, one for each day of the year instead of millions of individual eggs.
NB this breaks the traditional ALMaSS protocol for handling animal individuals.

Reimplemented from Population_Manager.

2560 {
2569 #ifdef __RECORD_RECOVERY_POLYGONS
2573  RecordRecoveryPolygons();
2574 #endif
2575  int today=m_TheLandscape->SupplyDayInYear();
2576  // WHOOAA!! This is really dangerous if these objects are registered anywhere
2577  // else in the system
2578  if (today==364)
2579  {
2580  for (unsigned j = 0; j<GetLiveArraySize( bob_Egg ); j++)
2581  {
2582  TheArray[bob_Egg][j]->KillThis(); // Destroy this
2583  }
2584  for (unsigned j = 0; j<GetLiveArraySize( bob_Larva ); j++)
2585  {
2586  TheArray[bob_Larva][j]->KillThis(); // Destroy this
2587  }
2588  for (unsigned j = 0; j<GetLiveArraySize( bob_Pupa ); j++)
2589  {
2590  TheArray[bob_Pupa][j]->KillThis(); // Destroy this
2591  }
2592  }
2593  else if (today==0)
2594  {
2595  for (int i=0; i<365; i++)
2596  {
2597  m_EList[i]->EggList.clear();
2598  m_EDayDeg[i]=0;
2599  m_LDayDeg[i][0]=0;
2600  m_LDayDeg[i][1]=0;
2601  m_LDayDeg[i][2]=0;
2602  m_PDayDeg[i]=0;
2603  }
2604  }
2605 
2606  double temptoday=m_TheLandscape->SupplyTemp();
2607  // Calculate the number of eggs laid today
2608  if (temptoday>AdultEggLayingThreshold)
2609  TodaysEggProduction=(int) floor(0.5+(((double)temptoday-
2611  else TodaysEggProduction=0;
2612  if (TodaysEggProduction>10)TodaysEggProduction=10; // ensure no bigger than 10
2613  // Calculated the DayDegrees for the different stages today
2614  if (temptoday>DevelConst1)
2615  {
2616  temptoday-=DevelConst1; // Subtract the threshold
2617  if (temptoday>DevelopmentInflectionPoint)
2618  {
2619  for(int i=0; i<=today; i++)
2620  {
2621  double et,l1t,l2t,l3t,pt;
2622  et=temptoday*above12Egg;
2623  l1t=temptoday*above12Larvae[0];
2624  l2t=temptoday*above12Larvae[1];
2625  l3t=temptoday*above12Larvae[2];
2626  pt=temptoday*above12Pupae;
2627  m_EDayDeg[i]+=et;
2628  m_LDayDeg[i][0]+=l1t;
2629  m_LDayDeg[i][1]+=l2t;
2630  m_LDayDeg[i][2]+=l3t;
2631  m_PDayDeg[i] += pt;
2632  }
2633  }
2634  else
2635  {
2636  for(int i=0; i<=today; i++)
2637  {
2638  m_EDayDeg[i]+=temptoday;
2639  m_LDayDeg[i][0]+=temptoday;
2640  m_LDayDeg[i][1]+=temptoday;
2641  m_LDayDeg[i][2]+=temptoday;
2642  m_PDayDeg[i]+=temptoday;
2643  }
2644  }
2645  }
2646  // Store the current population sizes
2651 
2652 #ifdef __LAMBDA_RECORD
2653  if (today==March) {
2654  LamdaDumpOutput();
2655  LamdaClear();
2656  }
2657 #endif
2658 
2659 #ifdef __BEETLEPESTICIDE1
2660  if (today==0) PestMortLocOutput();
2661 #endif
2662 
2663  // This replaces the BeginStep function for the eggs
2664  for (int i=0; i<365; i++)
2665  {
2666  m_EList[i]->BeginStep();
2667  }
2668 }
const double EggProductionSlope
Definition: Bembidion_all.cpp:135
const double above12Egg
Day degree constant above inflection point.
Definition: Bembidion_all.cpp:128
const double above12Larvae[3]
Day degree constant above inflection point.
Definition: Bembidion_all.cpp:130
const double above12Pupae
Day degree constant above inflection point.
Definition: Bembidion_all.cpp:132
const double DevelopmentInflectionPoint
Inflection point in larval day degree calculations.
Definition: Bembidion_all.cpp:118
const double DevelConst1
Day degree threshold constant for all stages.
Definition: Bembidion_all.cpp:120
const double AdultEggLayingThreshold
Temperature threshold for egg laying.
Definition: Bembidion_all.cpp:134
@ bob_Egg
Definition: bembidion_all.h:62
@ bob_Larva
Definition: bembidion_all.h:63
@ bob_Pupa
Definition: bembidion_all.h:64
virtual void BeginStep()
Egg_List class BeginStep code.
Definition: Bembidion_all.cpp:323
TListOfEggs EggList
The list of eggs.
Definition: bembidion_all.h:197
int m_LPopSize
To store the current population size.
Definition: bembidion_all.h:457
int m_EPopSize
To store the current population size.
Definition: bembidion_all.h:455
int m_AdPopSize
To store the current population size.
Definition: bembidion_all.h:453
int m_PPopSize
To store the current population size.
Definition: bembidion_all.h:459
double SupplyTemp(void)
Definition: landscape.h:1386
void LamdaDumpOutput()
Definition: PopulationManager.cpp:657
void LamdaClear()
Definition: PopulationManager.h:609
const int March
Definition: landscape.h:38

References above12Egg, above12Larvae, above12Pupae, AdultEggLayingThreshold, Bembidion_Egg_List::BeginStep(), bob_Adult, bob_Egg, bob_Larva, bob_Pupa, DevelConst1, DevelopmentInflectionPoint, Bembidion_Egg_List::EggList, EggProductionSlope, Population_Manager::GetLiveArraySize(), Population_Manager::LamdaClear(), Population_Manager::LamdaDumpOutput(), m_AdPopSize, m_EDayDeg, m_EList, m_EPopSize, m_LDayDeg, m_LPopSize, m_PDayDeg, m_PPopSize, Population_Manager::m_TheLandscape, March, Landscape::SupplyDayInYear(), Landscape::SupplyTemp(), Population_Manager::TheArray, and TodaysEggProduction.

◆ DoLast()

void Bembidion_Population_Manager::DoLast ( void  )
virtual

Adds output adult locations to DoLast.

Outputs the adult locations if needed

Reimplemented from Population_Manager.

2710 {
2712 #ifdef __BEETLEPESTICIDE1
2713  int today=m_TheLandscape->SupplyDayInYear();
2715  {
2717  {
2719  {
2720  if (m_TheLandscape->SupplyDayInMonth() == 1) DoInFieldLocationOutput();
2721  }
2722  else
2723  {
2724  if ( (today - cfg_SaveInfieldLocationStartDay.value()) % cfg_SaveInfieldLocationInterval.value() == 0) DoInFieldLocationOutput();
2725  }
2726  }
2727  }
2728 #endif
2729 }
static CfgInt cfg_SaveInfieldLocationStartDay("BEM_INCROPREFSTARTDAY", CFG_CUSTOM, -2)
Start day in year to record in-field locations.
static CfgBool cfg_SaveInfieldLocation("BEM_SAVEINFIELDLOC", CFG_CUSTOM, false)
Controls whether in-field off-field location should be recorded.
static CfgInt cfg_SaveInfieldLocationInterval("BEM_INCROPREFINTERVAL", CFG_CUSTOM, 10000)
Interval for recording in-crop locations - > 364 is ignored.
bool value(void)
Definition: configurator.h:135
int SupplyDayInMonth(void)
Definition: landscape.h:1606
virtual void DoLast()
Definition: PopulationManager.cpp:530

References cfg_SaveInfieldLocation, cfg_SaveInfieldLocationInterval, cfg_SaveInfieldLocationStartDay, Population_Manager::DoLast(), Population_Manager::m_TheLandscape, Landscape::SupplyDayInMonth(), Landscape::SupplyDayInYear(), CfgInt::value(), and CfgBool::value().

◆ Init()

void Bembidion_Population_Manager::Init ( void  )
virtual

Intialises the population manager.

Initialises the population manager and creates the initial beetle population.
Housekeeping actions such as setting up probe files and recording life-stage and state names are done here.
An optimisation is to sort the larval list by x-coordinate to speed searching later. This removes the default randomising function for larvae.

2409 {
2410 
2411  // autom. called by constructor
2412  if (cfg_RipleysOutput_used.value()) {
2414  }
2415  if ( cfg_ReallyBigOutput_used.value() ) {
2417  } else ReallyBigOutputPrb=0;
2418  strcpy(m_SimulationName,"Bembidion");
2419  // Create cfg_beetlestartnos adults
2420  struct_Bembidion* aps;
2421  aps = new struct_Bembidion;
2422  aps->BPM = this;
2423  aps->L = m_TheLandscape;
2424  for (int i=0; i<cfg_beetlestartnos.value(); i++)
2425  {
2426  do
2427  {
2430  } while (!IsStartHabitat(aps->x, aps->y));
2431  CreateObjects(3,NULL,NULL,aps,1);
2432  }
2433  delete aps;
2435  m_EPopSize=0;
2436  m_LPopSize=0;
2437  m_PPopSize=0;
2438 
2439 // Load List of Animal Classes
2440  m_ListNames[0]="Egg";
2441  m_ListNames[1]="Larva";
2442  m_ListNames[2]="Pupa";
2443  m_ListNames[3]="Adult";
2444  m_ListNameLength = 4;
2446 
2447 // Load State Names
2448  StateNames[tobs_Initiation] = "Initiation";
2449 //Egg
2450  StateNames[tobs_EDeveloping] = "Developing";
2451  StateNames[tobs_Hatching] = "Hatching";
2452  StateNames[tobs_EDying] = "Dying";
2453 //Larva
2454  StateNames[tobs_LDeveloping] = "Developing";
2455  StateNames[tobs_Pupating] = "Pupating";
2456  StateNames[tobs_LDying] = "Dying";
2457 //Pupa
2458  StateNames[tobs_PDeveloping] = "Developing";
2459  StateNames[tobs_Emerging] = "Emerging";
2460  StateNames[tobs_PDying] = "Dying";
2461 //Adult
2462  StateNames[tobs_Foraging] = "Foraging";
2463  StateNames[tobs_Aggregating] = "Aggregating";
2464  StateNames[tobs_Hibernating] = "Hibernating";
2465  StateNames[tobs_Dispersing] = "Dispersing";
2466  StateNames[tobs_ADying] = "Dying";
2467 
2468  // Ensure that larvae are sorted w.r.t. x position not shuffled
2469  BeforeStepActions[1]=1; // 1 = SortX
2470 
2471 #ifdef __RECORD_RECOVERY_POLYGONS
2472  /* Open the output file and append */
2473  ofstream ofile("RecoveryPolygonsCounter.txt",ios::out);
2474  ofile << "This file records the number of females in each polygon each day" << endl;
2475  ofile.close();
2476  /* Open the polygon recovery file and read in polygons to m_RecoveryPolygons */
2477  ifstream ifile("RecoveryPolygonsList.txt",ios::in);
2478  int n;
2479  ifile >> n;
2480  m_RecoveryPolygons[0] = n;
2481  for (int i=0; i<n; i++) ifile >> m_RecoveryPolygons[1+i];
2482  for (int i=0; i<n; i++) m_RecoveryPolygonsC[1+i]=0;
2483  ifile.close();
2484 #endif
2485 
2486 #ifdef __BEETLEPESTICIDE1
2487  PestMortLocOutputOpen();
2488  m_InFieldNo = 0;
2489  m_OffFieldNo = 0;
2490  m_InCropNo = 0;
2492  if (cfg_SaveInfieldLocation.value()) LocOutputOpen();
2493 #endif
2494  Bembidion_Adult ba(0,0,NULL,NULL);
2495 
2496  // Initialise any static variables
2497  ba.SetAdultPPPElimRate(cfg_BemAdultPPPElimiationRate.value()); // Initialize static variable
2498  ba.SetPPPThreshold(cfg_BemAdultPPPThreshold.value()); // Initialize static variable
2499  ba.SetPPPEffectProb(cfg_BemAdultPPPEffectProb.value()); // Initialize static variable
2500  ba.SetPPPEffectProbDecay(cfg_BemAdultPPPEffectProbDecay.value()); // Initialize static variable
2501 }
static CfgInt cfg_InCropRef("BEM_INCROPREF", CFG_CUSTOM, 603)
Defines the crop reference for in-crop if pest mort location or in-field locations are switched on.
static CfgInt cfg_beetlestartnos("BEM_STARTNO", CFG_CUSTOM, 10000)
Controls the numbers of adults entering the simulation.
static CfgFloat cfg_BemAdultPPPThreshold("BEM_ADPPPTHRESHOLD", CFG_CUSTOM, 9999999999.9)
Adult PPP threshold for effect.
CfgBool cfg_ReallyBigOutput_used
static CfgFloat cfg_BemAdultPPPEffectProb("BEM_ADPPPEFFECTPROB", CFG_CUSTOM, 0, 0.0, 1.0)
The probability of daily effect per day on threshold excedence.
static CfgFloat cfg_BemAdultPPPElimiationRate("BEM_ADPPPELIMIATIONRATE", CFG_CUSTOM, 0.0, 0.0, 1.0)
Pesticide body burden is multiplied by this daily.
static CfgFloat cfg_BemAdultPPPEffectProbDecay("BEM_ADPPPEFFECTPROBDECAY", CFG_CUSTOM, 0, 0.0, 1.0)
The probability of daily effect per day on threshold excedence.
CfgBool cfg_RipleysOutput_used
@ TOP_Beetle
Definition: PopulationManager.h:63
@ tobs_PDeveloping
Definition: bembidion_all.h:45
@ tobs_Aggregating
Definition: bembidion_all.h:50
@ tobs_PDying
Definition: bembidion_all.h:47
@ tobs_Hatching
Definition: bembidion_all.h:38
@ tobs_EDying
Definition: bembidion_all.h:39
@ tobs_Hibernating
Definition: bembidion_all.h:51
@ tobs_Pupating
Definition: bembidion_all.h:42
@ tobs_Dispersing
Definition: bembidion_all.h:52
@ tobs_LDeveloping
Definition: bembidion_all.h:41
@ tobs_Foraging
Definition: bembidion_all.h:49
@ tobs_LDying
Definition: bembidion_all.h:43
@ tobs_Initiation
Definition: bembidion_all.h:35
@ tobs_EDeveloping
Definition: bembidion_all.h:37
@ tobs_Emerging
Definition: bembidion_all.h:46
bool IsStartHabitat(int a_x, int a_y)
Used to specify legal starting habitats for simulation start-up.
Definition: Bembidion_all.cpp:2535
void CreateObjects(int ob_type, TAnimal *pvo, void *null, struct_Bembidion *data, int number)
Method to add beetles to the population.
Definition: Bembidion_all.cpp:2942
double value(void)
Definition: configurator.h:118
int SupplySimAreaHeight(void)
Definition: landscape.h:1637
int SupplySimAreaWidth(void)
Definition: landscape.h:1632
TTypesOfVegetation TranslateVegTypes(int VegReference)
Definition: landscape.h:1655
FILE * ReallyBigOutputPrb
Definition: PopulationManager.h:595
const char * m_ListNames[32]
Definition: PopulationManager.h:537
char m_SimulationName[255]
Definition: PopulationManager.h:513
unsigned BeforeStepActions[12]
Definition: PopulationManager.h:542
const char * StateNames[100]
Definition: PopulationManager.h:531
bool OpenTheRipleysOutputProbe(string a_NWordFilename)
Definition: PopulationManager.cpp:757
unsigned m_ListNameLength
Definition: PopulationManager.h:538
TTypesOfPopulation m_population_type
Definition: PopulationManager.h:580
bool OpenTheReallyBigProbe()
Definition: PopulationManager.cpp:859
A data class for Bembidion data.
Definition: bembidion_all.h:114
Bembidion_Population_Manager * BPM
Definition: bembidion_all.h:120

References Population_Manager::BeforeStepActions, struct_Bembidion::BPM, cfg_beetlestartnos, cfg_BemAdultPPPEffectProb, cfg_BemAdultPPPEffectProbDecay, cfg_BemAdultPPPElimiationRate, cfg_BemAdultPPPThreshold, cfg_InCropRef, cfg_ReallyBigOutput_used, cfg_RipleysOutput_used, cfg_SaveInfieldLocation, CreateObjects(), IsStartHabitat(), struct_Bembidion::L, m_AdPopSize, m_EPopSize, Population_Manager::m_ListNameLength, Population_Manager::m_ListNames, m_LPopSize, Population_Manager::m_population_type, m_PPopSize, Population_Manager::m_SimulationName, Population_Manager::m_TheLandscape, Population_Manager::OpenTheReallyBigProbe(), Population_Manager::OpenTheRipleysOutputProbe(), random(), Population_Manager::ReallyBigOutputPrb, Bembidion_Adult::SetAdultPPPElimRate(), Bembidion_Adult::SetPPPEffectProb(), Bembidion_Adult::SetPPPEffectProbDecay(), Bembidion_Adult::SetPPPThreshold(), Population_Manager::StateNames, Landscape::SupplySimAreaHeight(), Landscape::SupplySimAreaWidth(), tobs_ADying, tobs_Aggregating, tobs_Dispersing, tobs_EDeveloping, tobs_EDying, tobs_Emerging, tobs_Foraging, tobs_Hatching, tobs_Hibernating, tobs_Initiation, tobs_LDeveloping, tobs_LDying, tobs_PDeveloping, tobs_PDying, tobs_Pupating, TOP_Beetle, Landscape::TranslateVegTypes(), CfgInt::value(), CfgFloat::value(), CfgBool::value(), struct_Bembidion::x, and struct_Bembidion::y.

Referenced by Bembidion_Population_Manager().

◆ IsStartHabitat()

bool Bembidion_Population_Manager::IsStartHabitat ( int  a_x,
int  a_y 
)
protected

Used to specify legal starting habitats for simulation start-up.

2536 {
2538  tole=m_TheLandscape->SupplyElementType(a_x, a_y);
2539  switch(tole)
2540  {
2541  case tole_Field:
2542  case tole_Orchard:
2543  case tole_PermPasture:
2546  case tole_RoadsideVerge:
2547  case tole_NaturalGrassDry:
2548  case tole_NaturalGrassWet:
2549  case tole_FieldBoundary:
2551  case tole_YoungForest:
2552  case tole_WaterBufferZone:
2553  return true;
2554  default:
2555  return false;
2556  }
2557 }
TTypesOfLandscapeElement SupplyElementType(int a_polyref)
Definition: landscape.h:1110
TTypesOfLandscapeElement
Definition: tole_declaration.h:36
@ tole_PermPastureTussocky
Definition: tole_declaration.h:45
@ tole_WaterBufferZone
Definition: tole_declaration.h:108
@ tole_NaturalGrassWet
Definition: tole_declaration.h:87
@ tole_NaturalGrassDry
Definition: tole_declaration.h:48
@ tole_Field
Definition: tole_declaration.h:43
@ tole_PermPasture
Definition: tole_declaration.h:47
@ tole_FieldBoundary
Definition: tole_declaration.h:40
@ tole_RoadsideVerge
Definition: tole_declaration.h:38
@ tole_Orchard
Definition: tole_declaration.h:71
@ tole_YoungForest
Definition: tole_declaration.h:55
@ tole_PermPastureLowYield
Definition: tole_declaration.h:44
@ tole_UnsprayedFieldMargin
Definition: tole_declaration.h:72

References Population_Manager::m_TheLandscape, Landscape::SupplyElementType(), tole_Field, tole_FieldBoundary, tole_NaturalGrassDry, tole_NaturalGrassWet, tole_Orchard, tole_PermPasture, tole_PermPastureLowYield, tole_PermPastureTussocky, tole_RoadsideVerge, tole_UnsprayedFieldMargin, tole_WaterBufferZone, and tole_YoungForest.

Referenced by Init().

◆ Probe()

float Bembidion_Population_Manager::Probe ( int  ListIndex,
probe_data p_TheProbe 
)
virtual

Overides the Population_Manager::Probe method.

The parent class Probe method needs to be overridden because of the use of the Egg_List class. Otherwise functionality is the same as parent class.

Reimplemented from Population_Manager.

2746 {
2747  // Counts through the list and goes through each area to see if the animal
2748  // is standing there and if the farm, veg or element conditions are met
2749  AnimalPosition Sp;
2750  float NumberSk = 0;
2751  if (ListIndex==0)
2752  {
2753  unsigned X;
2754  unsigned Y;
2755  // Four possibilites
2756  // either NoVegTypes or NoElementTypes or NoFarmTypes is >0 or all==0
2757  if (p_TheProbe->m_NoFarms!=0)
2758  {
2759  for (int n=0; n<365; n++)
2760  {
2761  for (unsigned j=0; j<m_EList[n]->EggList.size(); j++)
2762  {
2763  Y=m_EList[n]->EggList[j].m_y;
2764  X=m_EList[n]->EggList[j].m_x;
2765  unsigned Farm=m_TheLandscape->SupplyFarmOwner(X,Y);
2766  for (unsigned i=0; i<p_TheProbe->m_NoAreas; i++)
2767  {
2768  if ((X>=p_TheProbe->m_Rect[i].m_x1)
2769  && (Y>=p_TheProbe->m_Rect[i].m_y1)
2770  && (X<=p_TheProbe->m_Rect[i].m_x2)
2771  && (Y<=p_TheProbe->m_Rect[i].m_y2))
2772  for (unsigned k=0; k<p_TheProbe->m_NoFarms; k++)
2773  {
2774  if (p_TheProbe->m_RefFarms[k]==Farm)
2775  NumberSk++; // it is in the square so increment number
2776  }
2777  }
2778  }
2779  }
2780  }
2781  else if (p_TheProbe->m_NoEleTypes!=0)
2782  {
2783  for (int n=0; n<365; n++)
2784  {
2785  for (unsigned j=0; j<m_EList[n]->EggList.size(); j++)
2786  {
2787  Y=m_EList[n]->EggList[j].m_y;
2788  X=m_EList[n]->EggList[j].m_x;
2789  int EleType = (int)m_TheLandscape->SupplyElementType(X,Y);
2790  for (unsigned i=0; i<p_TheProbe->m_NoAreas; i++)
2791  {
2792  if ((X>=p_TheProbe->m_Rect[i].m_x1)
2793  && (Y>=p_TheProbe->m_Rect[i].m_y1)
2794  && (X<=p_TheProbe->m_Rect[i].m_x2)
2795  && (Y<=p_TheProbe->m_Rect[i].m_y2))
2796  for (unsigned k=0; k<p_TheProbe->m_NoEleTypes; k++)
2797  {
2798  if (p_TheProbe->m_RefEle[k]==EleType)
2799  NumberSk++; // it is in the square so increment number
2800  }
2801  }
2802  }
2803  }
2804  }
2805  else if (p_TheProbe->m_NoVegTypes!=0)
2806  {
2807  for (int n=0; n<365; n++)
2808  {
2809  for (unsigned j=0; j<m_EList[n]->EggList.size(); j++)
2810  {
2811  Y=m_EList[n]->EggList[j].m_y;
2812  X=m_EList[n]->EggList[j].m_x;
2813  int VegType = (int)m_TheLandscape->SupplyVegType(X,Y);
2814  for (unsigned i=0; i<p_TheProbe->m_NoAreas; i++)
2815  {
2816  if ((X>=p_TheProbe->m_Rect[i].m_x1)
2817  && (Y>=p_TheProbe->m_Rect[i].m_y1)
2818  && (X<=p_TheProbe->m_Rect[i].m_x2)
2819  && (Y<=p_TheProbe->m_Rect[i].m_y2))
2820  for (unsigned k=0; k<p_TheProbe->m_NoVegTypes; k++)
2821  {
2822  if (p_TheProbe->m_RefVeg[k]==VegType)
2823  NumberSk++; // it is in the square so increment number
2824  }
2825  }
2826  }
2827  }
2828  }
2829  else // both must be zero
2830  {
2831  for (int n=0; n<365; n++)
2832  {
2833  for (unsigned j=0; j<m_EList[n]->EggList.size(); j++)
2834  {
2835  Y=m_EList[n]->EggList[j].m_y;
2836  X=m_EList[n]->EggList[j].m_x;
2837  for (unsigned i=0; i<p_TheProbe->m_NoAreas; i++)
2838  {
2839  if ((X>=p_TheProbe->m_Rect[i].m_x1)
2840  && (Y>=p_TheProbe->m_Rect[i].m_y1)
2841  && (X<=p_TheProbe->m_Rect[i].m_x2)
2842  && (Y<=p_TheProbe->m_Rect[i].m_y2))
2843  NumberSk++; // it is in the square so increment number
2844 
2845  }
2846  }
2847  }
2848  }
2849  }
2850  else
2851  {
2852  // Four possibilites
2853  // either NoVegTypes or NoElementTypes or NoFarmTypes is >0 or all==0
2854  if (p_TheProbe->m_NoFarms!=0)
2855  {
2856  for (unsigned j = 0; j<GetLiveArraySize( ListIndex ); j++)
2857  {
2858  Sp=TheArray[ListIndex][j]->SupplyPosition();
2859  unsigned Farm=TheArray[ListIndex][j]->SupplyFarmOwnerRef();
2860  for (unsigned i=0; i<p_TheProbe->m_NoAreas; i++)
2861  {
2862  if ((Sp.m_x>=p_TheProbe->m_Rect[i].m_x1)
2863  && (Sp.m_y>=p_TheProbe->m_Rect[i].m_y1)
2864  && (Sp.m_x<=p_TheProbe->m_Rect[i].m_x2)
2865  && (Sp.m_y<=p_TheProbe->m_Rect[i].m_y2))
2866  for (unsigned k=0; k<p_TheProbe->m_NoFarms; k++)
2867  {
2868  if (p_TheProbe->m_RefFarms[k]==Farm)
2869  NumberSk++; // it is in the square so increment number
2870  }
2871  }
2872  }
2873  }
2874  else if (p_TheProbe->m_NoEleTypes!=0)
2875  {
2876  for (unsigned j = 0; j < (unsigned) GetLiveArraySize( ListIndex ); j++)
2877  {
2878  Sp=TheArray[ListIndex][j]->SupplyPosition();
2879  for (unsigned i=0; i<p_TheProbe->m_NoAreas; i++)
2880  {
2881  if ((Sp.m_x>=p_TheProbe->m_Rect[i].m_x1)
2882  && (Sp.m_y>=p_TheProbe->m_Rect[i].m_y1)
2883  && (Sp.m_x<=p_TheProbe->m_Rect[i].m_x2)
2884  && (Sp.m_y<=p_TheProbe->m_Rect[i].m_y2))
2885  for (unsigned k=0; k<p_TheProbe->m_NoEleTypes; k++)
2886  {
2887  if (p_TheProbe->m_RefEle[k]==Sp.m_EleType)
2888  NumberSk++; // it is in the square so increment number
2889  }
2890  }
2891  }
2892  }
2893  else
2894  {
2895  if (p_TheProbe->m_NoVegTypes!=0)
2896  {
2897  for (unsigned j = 0; j<(unsigned)GetLiveArraySize( ListIndex ); j++)
2898  {
2899  Sp=TheArray[ListIndex][j]->SupplyPosition();
2900  for (unsigned i=0; i<p_TheProbe->m_NoAreas; i++)
2901  {
2902  if ((Sp.m_x>=p_TheProbe->m_Rect[i].m_x1)
2903  && (Sp.m_y>=p_TheProbe->m_Rect[i].m_y1)
2904  && (Sp.m_x<=p_TheProbe->m_Rect[i].m_x2)
2905  && (Sp.m_y<=p_TheProbe->m_Rect[i].m_y2))
2906 
2907  {
2908  for (unsigned k=0; k<p_TheProbe->m_NoVegTypes; k++)
2909  {
2910  if (p_TheProbe->m_RefVeg[k]==Sp.m_VegType)
2911  NumberSk++; // it is in the square so increment number
2912  }
2913  }
2914  }
2915  }
2916  }
2917  else // both must be zero
2918  {
2919  for (unsigned j = 0; j<(unsigned)GetLiveArraySize( ListIndex ); j++)
2920  {
2921  Sp=TheArray[ListIndex][j]->SupplyPosition();
2922  for (unsigned i=0; i<p_TheProbe->m_NoAreas; i++)
2923  {
2924  if ((Sp.m_x>=p_TheProbe->m_Rect[i].m_x1)
2925  && (Sp.m_y>=p_TheProbe->m_Rect[i].m_y1)
2926  && (Sp.m_x<=p_TheProbe->m_Rect[i].m_x2)
2927  && (Sp.m_y<=p_TheProbe->m_Rect[i].m_y2))
2928  NumberSk++; // it is in the square so increment number
2929  }
2930  }
2931  }
2932  }
2933  }
2934  return NumberSk;
2935 }
A class defining an animals position.
Definition: PopulationManager.h:170
unsigned m_x
Definition: PopulationManager.h:172
unsigned m_y
Definition: PopulationManager.h:173
TTypesOfLandscapeElement m_EleType
Definition: PopulationManager.h:174
TTypesOfVegetation m_VegType
Definition: PopulationManager.h:175
The base class for all farm types.
Definition: farm.h:768
int SupplyFarmOwner(int a_x, int a_y)
Definition: landscape.h:1152
TTypesOfVegetation SupplyVegType(int a_x, int a_y)
Definition: landscape.h:1321
unsigned m_NoAreas
Definition: PopulationManager.h:292
TTypesOfVegetation m_RefVeg[25]
Definition: PopulationManager.h:297
rectangle m_Rect[10]
Definition: PopulationManager.h:293
unsigned m_RefFarms[25]
Definition: PopulationManager.h:299
unsigned m_NoFarms
Definition: PopulationManager.h:296
TTypesOfLandscapeElement m_RefEle[25]
Definition: PopulationManager.h:298
unsigned m_NoVegTypes
Definition: PopulationManager.h:295
unsigned m_NoEleTypes
Definition: PopulationManager.h:294
unsigned m_x1
Definition: PopulationManager.h:100
unsigned m_x2
Definition: PopulationManager.h:102
unsigned m_y2
Definition: PopulationManager.h:103
unsigned m_y1
Definition: PopulationManager.h:101

References Bembidion_Egg_List::EggList, Population_Manager::GetLiveArraySize(), AnimalPosition::m_EleType, m_EList, probe_data::m_NoAreas, probe_data::m_NoEleTypes, probe_data::m_NoFarms, probe_data::m_NoVegTypes, probe_data::m_Rect, probe_data::m_RefEle, probe_data::m_RefFarms, probe_data::m_RefVeg, Population_Manager::m_TheLandscape, AnimalPosition::m_VegType, AnimalPosition::m_x, rectangle::m_x1, rectangle::m_x2, AnimalPosition::m_y, rectangle::m_y1, rectangle::m_y2, Landscape::SupplyElementType(), Landscape::SupplyFarmOwner(), Landscape::SupplyVegType(), and Population_Manager::TheArray.

◆ SupplyAdPopSize()

int Bembidion_Population_Manager::SupplyAdPopSize ( )
inline

Get adult population size.

408 {return m_AdPopSize;}

References m_AdPopSize.

◆ SupplyEDayDeg()

double Bembidion_Population_Manager::SupplyEDayDeg ( int  day)
inline

Get egg day degress for a specific day.

416 { return m_EDayDeg[day];}

References m_EDayDeg.

Referenced by Bembidion_Egg_List::st_Develop().

◆ SupplyEggPopSize()

int Bembidion_Population_Manager::SupplyEggPopSize ( )
inline

Get egg population size.

410 {return m_EPopSize;}

References m_EPopSize.

◆ SupplyLarvaePopSize()

int Bembidion_Population_Manager::SupplyLarvaePopSize ( )
inline

Get larval population size.

412 {return m_LPopSize;}

References m_LPopSize.

◆ SupplyLDayDeg()

double Bembidion_Population_Manager::SupplyLDayDeg ( int  L,
int  day 
)
inline

Get larval day degress for a specific dayand instar.

418 { return m_LDayDeg[day][L];}

References m_LDayDeg.

Referenced by Bembidion_Larvae::st_Develop().

◆ SupplyPDayDeg()

double Bembidion_Population_Manager::SupplyPDayDeg ( int  day)
inline

Get pupal day degress for a specific day.

420 { return m_PDayDeg[day];}

References m_PDayDeg.

Referenced by Bembidion_Pupae::st_Develop().

◆ SupplyPupaePopSize()

int Bembidion_Population_Manager::SupplyPupaePopSize ( )
inline

Get pupal population size.

414 {return m_PPopSize;}

References m_PPopSize.

◆ TheAOROutputProbe()

void Bembidion_Population_Manager::TheAOROutputProbe ( )
protectedvirtual

Special output functionality.

Reimplemented from Population_Manager.

3050 {
3052 }
virtual void DoProbe(int a_lifestage)
Definition: AOR_Probe.cpp:59
AOR_Probe * m_AOR_Probe
Definition: PopulationManager.h:526

References bob_Adult, AOR_Probe::DoProbe(), and Population_Manager::m_AOR_Probe.

◆ TheReallyBigOutputProbe()

void Bembidion_Population_Manager::TheReallyBigOutputProbe ( )
protectedvirtual

Special output functionality.

Another spatial output method. This time with extra information over and above the x,y, coord found in the Ripley Probe.

Reimplemented from Population_Manager.

3030  {
3031  Bembidion_Adult* FS;
3032  unsigned totalF = (unsigned)GetLiveArraySize( bob_Adult );
3033  int x,y;
3036  fprintf(ReallyBigOutputPrb,"%d %d %d %d %d\n", 0,w ,0, h, totalF);
3037  for (unsigned j=0; j<totalF; j++) //adult females
3038  {
3039  FS=dynamic_cast<Bembidion_Adult*>(TheArray[3][j]);
3040  if (FS->GetCurrentStateNo() != -1) {
3041  x = FS->Supply_m_Location_x();
3042  y = FS->Supply_m_Location_y();
3043  int poly = m_TheLandscape->SupplyPolyRef(x, y);
3044  fprintf(ReallyBigOutputPrb, "%d\t%d\t%d\n", x, y, poly);
3045  }
3046  }
3047  fflush(ReallyBigOutputPrb);
3048 }
int SupplyPolyRef(int a_x, int a_y)
Definition: landscape.h:1488
int GetCurrentStateNo()
Returns the current state number.
Definition: PopulationManager.h:121
int Supply_m_Location_x()
Definition: PopulationManager.h:213
int Supply_m_Location_y()
Definition: PopulationManager.h:216

References bob_Adult, TALMaSSObject::GetCurrentStateNo(), Population_Manager::GetLiveArraySize(), Population_Manager::m_TheLandscape, Population_Manager::ReallyBigOutputPrb, TAnimal::Supply_m_Location_x(), TAnimal::Supply_m_Location_y(), Landscape::SupplyPolyRef(), Landscape::SupplySimAreaWidth(), and Population_Manager::TheArray.

◆ TheRipleysOutputProbe()

void Bembidion_Population_Manager::TheRipleysOutputProbe ( FILE *  a_prb)
protectedvirtual

Special output functionality.

A spatial output. This dumps the x,y co-ordinates for all adults to a text file.

Reimplemented from Population_Manager.

3007  {
3008  Bembidion_Adult* FS;
3009  unsigned totalF = (unsigned)(unsigned)GetLiveArraySize( bob_Adult );
3010  int x,y;
3013  fprintf(a_prb,"%d %d %d %d %d\n", 0,w ,0, h, totalF);
3014  for (unsigned j=0; j<totalF; j++) //adult females
3015  {
3016  FS = dynamic_cast<Bembidion_Adult*>(TheArray[bob_Adult][j]);
3017  if (FS->GetCurrentStateNo() != -1) {
3018  x = FS->Supply_m_Location_x();
3019  y = FS->Supply_m_Location_y();
3020  fprintf(a_prb, "%d\t%d\n", x, y);
3021  }
3022  }
3023  fflush(a_prb);
3024 }

References bob_Adult, TALMaSSObject::GetCurrentStateNo(), Population_Manager::GetLiveArraySize(), Population_Manager::m_TheLandscape, TAnimal::Supply_m_Location_x(), TAnimal::Supply_m_Location_y(), Landscape::SupplySimAreaWidth(), and Population_Manager::TheArray.

Member Data Documentation

◆ ADDepMort0

int Bembidion_Population_Manager::ADDepMort0

Storage for density-dependent mortality parameter.

Referenced by Bembidion_Population_Manager(), and Bembidion_Adult::DDepMort().

◆ ADDepMort1

double Bembidion_Population_Manager::ADDepMort1

Storage for density-dependent mortality parameter.

Referenced by Bembidion_Population_Manager(), and Bembidion_Adult::DDepMort().

◆ LDDepMort0

int Bembidion_Population_Manager::LDDepMort0

Storage for density-dependent mortality parameter.

Referenced by Bembidion_Population_Manager(), and Bembidion_Larvae::st_Develop().

◆ LDDepMort1

double Bembidion_Population_Manager::LDDepMort1

Storage for density-dependent mortality parameter.

Referenced by Bembidion_Population_Manager(), and Bembidion_Larvae::st_Develop().

◆ m_AdPopSize

int Bembidion_Population_Manager::m_AdPopSize
protected

To store the current population size.

Referenced by DoFirst(), Init(), and SupplyAdPopSize().

◆ m_AdultPosMap

◆ m_EDayDeg

double Bembidion_Population_Manager::m_EDayDeg[365]
protected

Storage for daily day degrees for eggs.

Referenced by Bembidion_Population_Manager(), DoFirst(), and SupplyEDayDeg().

◆ m_EList

Bembidion_Egg_List* Bembidion_Population_Manager::m_EList[365]

◆ m_EPopSize

int Bembidion_Population_Manager::m_EPopSize
protected

To store the current population size.

Referenced by DoFirst(), Init(), and SupplyEggPopSize().

◆ m_LarvaePosMap

◆ m_LDayDeg

double Bembidion_Population_Manager::m_LDayDeg[365][3]
protected

Storage for daily day degrees for larve.

Referenced by Bembidion_Population_Manager(), DoFirst(), and SupplyLDayDeg().

◆ m_LPopSize

int Bembidion_Population_Manager::m_LPopSize
protected

To store the current population size.

Referenced by DoFirst(), Init(), and SupplyLarvaePopSize().

◆ m_MoveMap

MovementMap* Bembidion_Population_Manager::m_MoveMap

◆ m_PDayDeg

double Bembidion_Population_Manager::m_PDayDeg[365]
protected

Storage for daily day degrees for pupae.

Referenced by Bembidion_Population_Manager(), DoFirst(), and SupplyPDayDeg().

◆ m_PPopSize

int Bembidion_Population_Manager::m_PPopSize
protected

To store the current population size.

Referenced by DoFirst(), Init(), and SupplyPupaePopSize().

◆ The_Landscape

Landscape* Bembidion_Population_Manager::The_Landscape
protected

Pointer to the landscape.

◆ TodaysEggProduction

int Bembidion_Population_Manager::TodaysEggProduction

Daily temperature determined egg production.

Referenced by Bembidion_Population_Manager(), Bembidion_Adult::CanReproduce(), and DoFirst().


The documentation for this class was generated from the following files: